package cn.haigui.icrawler.core.downloader;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;

public class JsoupDownloader implements IDownloader{

    Document document;
    String currentUrl;

    @Override
    public Document get(String url) throws IOException {
        currentUrl=url;
        this.document = Jsoup.connect(url).get();
        return document;
    }

    @Override
    public String getPageSource() {
        return document==null?null:document.html();
    }

    @Override
    public String getCurrentUrl() {
        return currentUrl;
    }

    @Override
    public void quit() {
    }
}
